package com.umgsai.thread.thread07;

public class Task {

	public void doLongTimeTask() {
		/*
		for (int i = 0; i < 100; i++) {
			System.err.println("异步执行，线程名：" + Thread.currentThread().getName() + "---" + i);
		}
		*/
		synchronized(this){
			for (int i = 0; i < 100; i++) {
				System.out.println("同步执行，线程名：" + Thread.currentThread().getName() + "---" + i);
			}
		}
	}
	
	synchronized public void otherMethod() {
		System.err.println("Run otherMethod....");
	}
}
